import {createStore} from 'vuex'
export default createStore({
    state: {
        userinfo: {
            uid:'',
            nickname:'',
            avatar:''
        },
        aliveList: [],
        currentTab: 0
    },
    mutations: {
        setUserinfo(state) {
            state.userinfo.uid = localStorage.getItem('web_uid') ? localStorage.getItem('web_uid') : ''
            state.userinfo.nickname = localStorage.getItem('web_nickname') ? localStorage.getItem('web_nickname') : ''
            state.userinfo.avatar = localStorage.getItem('web_avatar') ? localStorage.getItem('web_avatar') : ''
        },
        setHeaderTab(state,data) {
            state.currentTab = data
        },
        setAliveItem(state, data) {
            state.aliveList.push(data)
        },
        clearAlive(state) {
            state.aliveList = []
        }
    },
    actions: {},
    modules: {}
})